﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Main
{
    class ThreadTaskHolder
    {

        public string LoginId { get; set; }

        public string Password { get; set; }

        public TextBox TxtStart { get; set; }

        public TextBox TxtEnd { get; set; }

        public TextBox TxtResult { get; set; }

        public CheckBox ChkBox { get; set; }


        public void UpdateText(Control control,string str)
        {
            control.Invoke(new Action(() =>
            {
                control.Text = str;
            }));
        }

        public void Disabled()
        {
            TxtStart.Invoke(new Action(() =>
            {
                TxtStart.Enabled = false;
                TxtEnd.Enabled = false;
                TxtResult.Enabled = false;
                ChkBox.Enabled = false;
            }));
        }

        public void Enabled()
        {
            TxtStart.Invoke(new Action(() =>
            {
                TxtStart.Enabled = true;
                TxtEnd.Enabled = true;
                TxtResult.Enabled = true;
                ChkBox.Enabled = true;
            }));
        }

        public void Successed(string currentCode)
        {
            TxtResult.Invoke(new Action(() =>
            {
                TxtResult.BackColor = System.Drawing.Color.Green;
                TxtResult.ForeColor = System.Drawing.Color.White;
                TxtResult.Text = currentCode;
            }));
        }

        public void UpdateCurrent(string currentCode)
        {
            TxtResult.Invoke(new Action(() =>
            {
                TxtResult.Text = currentCode;
            }));
        }

    }
}
